import { result, getNowTime, mockPageRes, qsparse } from '../util'

const mockOrderList = (params) => result(() => {
  const list = []
  const o1 = { supplierCode: 'C00001', supplierName: '深圳动力有限公司', level: 'A', province: '43', provinceText: '湖南省', city: '4311', cityText: '永州市', region: '431128', regionText: '新田县', contactsName: '王已名', contactsPhone: '1893443431', address: '北京市海淀区19号', remark: '测试未订单号', chargePerson: '王力', createTime: getNowTime(), updateTime: getNowTime(), creater: '王菲' }
  const o2 = { supplierCode: 'C00002', supplierName: '北京和风集团', level: 'B', province: '43', city: '4311', cityText: '永州市', region: '431128', regionText: '新田县', contactsName: '刘大海', contactsPhone: '1893443431', address: '北京市海淀区', remark: '测试已提交订单号', chargePerson: '王力', createTime: getNowTime(), updateTime: getNowTime(), creater: '王菲' }
  const o3 = { supplierCode: 'C00001', supplierName: '深圳动力有限公司', level: 'C', province: '43', city: '4311', cityText: '永州市', region: '431128', regionText: '新田县', contactsName: '李斯', contactsPhone: '1893443431', address: '北京市海淀区', remark: '', chargePerson: '王力', createTime: getNowTime(), updateTime: getNowTime(), creater: '王菲' }
  list.push(o1, o2, o3)
  return mockPageRes(params, list)
})
export default {
  'post|/api/purchase/getSupplierList': (option) => {
    const params = qsparse(option.body)
    return mockOrderList(params)
  }
}
